<%@ page import="com.informet.ipd.modelo.dao.*"%>
<%@ page import="com.informet.ipd.modelo.vo.*"%>
<%@ page import="com.informet.ipd.struts.form.PEIForm" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.swing.JOptionPane"%>
<%@ page language="java"  pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %>
<%@ taglib uri="/tags/c" prefix="c"%>

<%
            StringBuffer cadenaSalida = new StringBuffer();
            List lista = null;
            int cant = Integer.parseInt(request.getParameter("cuMetaO"));
            CMObjetivoDao supportFacade = new CMObjetivoDao();
            PEIForm form1 = new PEIForm();
            CMObjetivoVO cmObj = null;
            try {
                
                int anioMetaO = Integer.parseInt(request.getParameter("anioMetaO"));
                int codMeta = Integer.parseInt(request.getParameter("codMeta"));
                int metodo = Integer.parseInt(request.getParameter("metodo"));
                int idcuMetaO = Integer.parseInt(request.getParameter("idcuMetaO"));

              
                cmObj = new CMObjetivoVO( anioMetaO, cant, codMeta,idcuMetaO);
                supportFacade.spMan(metodo, cmObj);
                lista = supportFacade.getlist(codMeta);
                form1.setListacuMetaO(lista);

                cadenaSalida.append("<table id='tabla1' width='99%' align='right' class='userTable'>");
                cadenaSalida.append("<tr class='even' align='center'>");
                cadenaSalida.append("<th class='textoTR'>#</th>");
                cadenaSalida.append("<th class='textoTR'>A&ntilde;o</th>");
                cadenaSalida.append("<th class='textoTR'>Cantidad</th>");
                cadenaSalida.append("<th class='textoTR'>Editar</th>");
                cadenaSalida.append("<th class='textoTR'>Eliminar</th>");
                cadenaSalida.append("</tr>");
                int i=1;
                Iterator it = lista.iterator();
                while (it.hasNext()) {
                    cmObj = (CMObjetivoVO) it.next();

                    cadenaSalida.append("<tr align='center'>");
                    cadenaSalida.append("<td width='10%' align='center'>" +cmObj.getNUM_IDOBJ()+"." +cmObj.getNUM_IDMOBJ()+"." + cmObj.getNUM_IDCUMETAO()+"." + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>"+cmObj.getNUM_ANIOMETAO_PK()+"</td>");
                    cadenaSalida.append("<td width='10%' align='center'>"+cmObj.getNUM_CUMETAO()+"</td>");
                    cadenaSalida.append("<td width='10%' align='center'>");
                    cadenaSalida.append("<img style='cursor:pointer' title='Editar' alt='Editar' border=0  src='images/b_edit.png' onclick=\"editarT('"+cmObj.getNUM_ANIOMETAO_PK() + "','" + cmObj.getNUM_IDCUMETAO()+ "','" + cmObj.getNUM_CUMETAO()+"');posicioninicial();\" >");
                    cadenaSalida.append("</td>");
                    cadenaSalida.append("<td width='10%' align='center'> ");
                    cadenaSalida.append("<img style='cursor:pointer' title='Eliminar' alt='Eliminar' border=0  src='images/b_drop.png' onclick=\"eliminar('"+cmObj.getNUM_ANIOMETAO_PK()+"');\" >");
                    cadenaSalida.append("</td>");
                    
                    cadenaSalida.append("</tr>");
                }
                cadenaSalida.append("</table>");
            } catch (Exception e) {
                   cadenaSalida.append("error : "+e.toString());
            }
            out.print(cadenaSalida);
%>